import {
  // addHistory,
  // clearHistory,
  // deleteHistory,
  cacheUserInfo,
  getAvatar
} from 'assets/js/cache'
import { getUserBaseInfo } from 'api/user'

export const updateTestValue = function({ commit, state }, data) {
  commit('updateTestValue', data)
}

export const saveUserInfo = function({ commit, state }, data) {
  commit('saveUserInfo', cacheUserInfo(data))
}

export const refreshUserInfo = async function({ commit, state }) {
  var res = await getUserBaseInfo()
  var userInfo = res
  userInfo.FaviconURL = userInfo.FaviconURL || getAvatar()
  commit('saveUserInfo', cacheUserInfo(userInfo))
}

// export function addHistoryList({ commit, state }, data) {
//   commit('setHistoryList', addHistory(data))
// }

// export function deleteHistoryList({ commit, state }, data) {
//   commit('setHistoryList', deleteHistory(data))
// }

// export function clearHistoryList({ commit, state }, module) {
//   commit('setHistoryList', clearHistory(module))
// }
